package com.sxt.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sxt.system.domain.Menu;
import com.sxt.system.mapper.MenuMapper;
import com.sxt.system.service.MenuService;
@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService{

    @Override
    public List<Menu> queryAllMenuForList(Menu menu) {
        QueryWrapper<Menu> qw=new QueryWrapper<>();
        qw.eq(menu.getAvailable()!=null,"available",menu.getAvailable());
        qw.eq(StringUtils.isNotBlank(menu.getType()),"type",menu.getType());
        qw.orderByAsc("ordernum");
        return this.baseMapper.selectList(qw);
    }

    /**
     * 这个方法后期的改
     * @param menu
     * @param userId
     * @return
     */
    @Override
    public List<Menu> queryeMenuByUserIdForList(Menu menu, Integer userId) {
        return this.queryAllMenuForList(menu);
    }
}
